

<!--********************* Part1:Jsp Head *********************-->

<%@ page contentType="text/html;charset=UTF-8"%>  
<%@ include file="/framework/head.jsp"%>

<!--********************* Part2:Java Code *********************-->
<%
    boolean bMulti = context.getBoolean("multi");
    ProviderSearchEvent event = (ProviderSearchEvent)context.getSessionValue("ProviderSearchEvent");
	ObjectList list = Provider.fetch().search(con,event);
    
	bNeedAllCheckbox = false;
    if (bMulti)
    {
        bNeedAllCheckbox = true;
    }
%>

<!--********************* Part3:JavaScript Code ***************-->
<!--start 客户端脚本区域-->
<script language=javascript>

var list_code = "selectProvider";

function doSearch()
{
	SetValue("s_Code",GetValue("i_Code")); //编码

	SetValue("s_Name",GetValue("i_Name")); //名称

	SetValue("s_IsTradeflatProvider",GetValue("i_IsTradeflatProvider")); //是否交易平台的供应商

	SetValue("s_Status",GetValue("i_Status")); //是否有效

	SetValue("s_OrderField",GetValue("i_OrderField")); //排序
	SetValue("s_OrderDesc",getCheckBoxValues("i_OrderDesc")); //升降序
	doCommonSearch();
}

function bizViewProvider(id)
{
	viewWin("<%=Config.getSrv()%>?action_code=viewProvider&Id="+id);
}

function doDelete()
{
	if(!hasChooseRadio("ids"))
	{
		bizMessage("删除","供应商");
		return false;
	}
	if(!bizConfirm("删除","供应商")) return false;
	SetAction("deleteProvider");
	frm.submit();
}

function doToAdd()
{
	SetAction("toAddProvider");
	frm.submit();
}

function doToUpdate()
{
	if(!checkOne("ids")) 
	{
		bizMessage("修改","供应商");
		return false;
	}
	SetValue("Id",getCheckBoxValue("ids"));
	SetAction("toUpdateProvider");
	frm.submit();
}
function doToCopy()
{
	if(!checkOne("ids")) 
	{
		bizMessage("复制","供应商");
		return false;
	}
	SetValue("Id",getCheckBoxValue("ids"));
	SetAction("toCopyProvider");
	frm.submit();
}

function doChoose(id)
{
    var xml = document.all("xml_"+id).value;
    var obj = xmlToObject(xml) ;
    if(window.opener!=null)
    {
        if(window.opener.onSelectProvider!=null)
        {
            window.opener.onSelectProvider(obj);
            window.close();
        }
    }
}

function doChooseMulti()
{
    var ids = getCheckBoxValues("ids");
    var xml ;
    var obj ; 
    var objs = new Array();
    var i ;
    
    for(i=0;i<ids.length;i++)
    {       
        xml = document.all("xml_"+ids[i]).value;
        obj = xmlToObject(xml) ;
        objs[objs.length] = obj;
    }
    
    if(window.opener!=null)
    {
        if(window.opener.onSelectProviders!=null)
        {
            window.opener.onSelectProviders(objs);
            window.close();
        }
    }
    
}

key_InitDefault();
key_RegSubmitHandler(doSearch);
</script>


<%=uiBody%>>

<%@ include file="/framework/menu.jsp"%>

<!--********************* Part4:Form  ***************-->
<form id=frm action="<%=Config.getSrv()%>" method="post">
<input type=hidden name="action_code" value="">
<input type=hidden name="Id" value="">
<input type=hidden name=sortOrder value="1">

<!--查询条件保留区域-->

<input type=hidden name="s_Code" value="<%=event.getCode()%>"> <!--编码-->

<input type=hidden name="s_Name" value="<%=event.getName()%>"> <!--名称-->

<input type=hidden name="s_IsTradeflatProvider" value="<%=event.getIsTradeflatProvider()%>"> <!--是否交易平台的供应商-->

<input type=hidden name="s_Status" value="<%=event.getStatus()%>"> <!--是否有效-->

<%@ include file="/framework/list_head.jsp"%>

<br>
<!--********************* Part5:Search Area ***************-->
<%=uiSearchStart%>>
<%
	int key_tab = 1 ;
%>

	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			供应商编码：
			<input type="text" class="texts" name="i_Code" size="20" value="<%=event.viewCode()%>" key_tab="<%=key_tab++%>">
			供应商名称：
			<input type="text" class="texts" name="i_Name" size="20" value="<%=event.viewName()%>" key_tab="<%=key_tab++%>">
              数据类型：
            <%=SelectManager.viewYesOrNoSelectDEALorHAND ("i_IsTradeflatProvider",event.viewIsTradeflatProvider(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%> 
		</td>		
	</tr>

	<%=uiSearchInputTR%>>
		<%=uiSearchInputTDHead%>>
			有&nbsp;&nbsp;效&nbsp;&nbsp;性：
             <!--<%=SelectManager.viewYesOrNoSelect("i_Status",event.viewStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>-->
             
            
			<%=SelectManager.viewYesOrNoSelect("i_Status",event.viewStatus(),true,"",SelectManager.SELECT_ALL,"","key_tab="+(key_tab++))%>
              按&nbsp;&nbsp;排&nbsp;&nbsp;序：
			
			<select name="i_OrderField">
                <option value="" <%=(event.getOrderField().equals("1"))?"selected":""%>>设置排序字段</option>
				
				<option value="CODE" <%=(event.getOrderField().equals("CODE"))?"selected":""%>>供应商编码</option>
				
				<option value="NAME" <%=(event.getOrderField().equals("NAME"))?"selected":""%>>供应商名称</option>
				
				<!-- 
                <option value="MANAGE_PERSON" <%=(event.getOrderField().equals("MANAGE_PERSON"))?"selected":""%>>负责人</option>
				
				<option value="MANAGER_TEL" <%=(event.getOrderField().equals("MANAGER_TEL"))?"selected":""%>>负责人电话</option>
                 -->
				
				<option value="IS_TRADEFLAT_PROVIDER" <%=(event.getOrderField().equals("IS_TRADEFLAT_PROVIDER"))?"selected":""%>>数据类型</option>
				
				<option value="STATUS" <%=(event.getOrderField().equals("STATUS"))?"selected":""%>>有效性</option>
				
			</select>
			&nbsp;&nbsp;
			<input type="radio" name="i_OrderDesc" value="false" <%=(event.isOrderDesc()==false)?"checked":""%> >升序
			<input type="radio" name="i_OrderDesc" value="true"  <%=(event.isOrderDesc()==true)?"checked":""%>  >降序
			<input type="button" value="查询" class="buttons" onclick="doSearch();return false;">&nbsp;<input type="button" value="清空" class="buttons" onclick="doClearEvent();return false;">
		</td>
	</tr>

<%=uiSearchEnd%>

<!--列表标题-->
<%=UIManager.addListHeadTitle("供应商列表")%>

<!--********************* Part6:List Area ***************-->

<%=uiListStart%>>

<%@ include file="/framework/list_foot.jsp"%>

<%
	int index = 1 ;
%>


	<%=uiListHeadTR%>>
		<%
    if(bMulti)
    {
%>  
        <%=UIManager.addListHeadCheckBox() %>
<%  
    }
    else 
    {
%>
        <%=UIManager.addListHead("操作",index++)%>
<%  
    }
%>  

		<%=UIManager.addListHead("供应商编码",index++)%>

		<%=UIManager.addListHead("供应商名称",index++)%>

		<%=UIManager.addListHead("负责人",index++)%>

		<%=UIManager.addListHead("负责人电话",index++)%>

		<%=UIManager.addListHead("数据类型",index++)%>

		<%=UIManager.addListHead("有效性",index++)%>
     
		<%=UIManager.addListHead("操作",-1)%>  
	<%=uiListHeadTREnd%>>
	
	<!--data-->
<%
	for(int i=0;i<list.size();i++)
	{
		Provider obj = (Provider)list.get(i);
%>
	<input type=hidden name="xml_<%=obj.getId()%>" value="<%=obj.toXml()%>">
    <%=uiListDataTR[i%2]%> align=center>
<%
    if(bMulti)
    {
%>  
        <%=uiListDataTD%>>
            <input type="checkbox" name="ids" <%=UIManager.addListDataCheckBoxAble(obj.getId())%> value="<%=obj.getId()%>">
        </td>
<%  
    }
    else 
    {
%>
        <%=uiListDataTD%>>
            <input type=button class=buttons value="选择" onclick="doChoose('<%=obj.getId()%>');return false;">
        </td>
<%  
    }
%>
    	
    	<%=uiListDataTD%>><%=obj.viewCode(con)%></td>
    
    	<%=uiListDataTD%>><%=obj.viewName(con)%></td>
    
    	<%=uiListDataTD%>><%=obj.viewManagePerson(con)%></td>
    
    	<%=uiListDataTD%>><%=obj.viewManagerTel(con)%></td>
    
    	<%=uiListDataTD%>><%=(obj.viewIsTradeflatProvider(con).equals(ConstDefine.STR_VAL_DEAL))?ConstDefine.STR_NAME_DEAL:ConstDefine.STR_NAME_HAND%></td>
    
    	<%=uiListDataTD%>><%=(obj.viewStatus(con).equals(ConstDefine.STR_YES))?ConstDefine.STR_NAME_VALID_YES:ConstDefine.STR_NAME_VALID_NO%></td>

    	<%=uiListDataTD%>>
    		<a href="" onclick="bizViewProvider('<%=obj.getId()%>');return false;">浏览</a>
    	</td>
  	</tr>
<%	
	}
%>  

<%@ include file="/framework/list_foot2.jsp"%>

<%=uiListEnd%>


<!--********************* Part7:Action Area ***************-->
<%=uiCommandStart%>>
	<%=uiCommandTR%>>
		<%=uiCommandTD%>>
        <!--
		<input type=button value="    添加   " class="buttons" onclick="doToAdd();return false;">
		
		<input type=button value="    复制   " class="buttons" onclick="doToCopy();return false;">
		
		<input type=button value="    修改   " class="buttons" onclick="doToUpdate();return false;">
		<input type=button value="    删除   " class="buttons" onclick="doDelete();return false;">
		-->
        
<%
    if(bMulti)
    {
%>
        <input type=button value="选择" class="buttons" onclick="doChooseMulti();return false;">
<%  
    }
%>          
        
        
        </td>
	</tr>	
<%=uiCommandEnd%>
</form>


<%@ include file="/framework/foot.jsp"%>

<!--
	Author    :Arrow
	FileName  :/system/base/ProviderSelect.jsp
-->
